package hu.donpedropizza;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class TermOfUse extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.termofuse);
		TextView termOfUseText = (TextView) findViewById(R.id.termOfUseText);
		termOfUseText.setText(readTxt());
	}

	private String readTxt() {
		InputStream inputStream = getResources().openRawResource(
				R.raw.termofuse);
		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
		int i;
		
		try {
			i = inputStream.read();
			while (i != -1) {
				byteArrayOutputStream.write(i);
				i = inputStream.read();
			}
			inputStream.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return byteArrayOutputStream.toString();
	}

	public void back(View view) {
		this.finish();
	}
}
